package code

import (
	"encoding/base64"
)

/**
Base64和标准库没什么区别，标准库已经很好用了，只是为了抄一遍
*/
func Base64StdEncode(in []byte) string {
	return base64.StdEncoding.EncodeToString(in)
}

func Base64StdDecode(in string) ([]byte, error) {
	decodeBytes, err := base64.StdEncoding.DecodeString(in)
	return decodeBytes, err
}

func Base64UrlEncode(in []byte) string {
	return base64.URLEncoding.EncodeToString(in)
}

func Base64UrlDecode(in string) ([]byte, error) {
	decodeBytes, err := base64.URLEncoding.DecodeString(in)
	return decodeBytes, err
}
